package com.zhiliao.common.db.kit;

import com.zhiliao.common.db.impl.M;

import static com.zhiliao.common.db.impl.M.*;

/**
 * Description:Mysql db table filed utils
 *
 * @author Jin
 * @create 2017-05-11
 **/
public class MysqlFiledUtil {

    public static boolean isAutoIncrementFiled(M filedType){
        if(filedType == BIG_INT_TYPE) {
            return true;
        }
         if(filedType == INT_TYPE) {
             return true;
         }
         if(filedType == TNY_INT_TYPE) {
             return true;
         }
         if(filedType == SMALL_INT_TYPE) {
             return true;
         }
         if(filedType == MEDIUM_INT_TYPE) {
             return true;
         }
         return false;
    }

    public static boolean isCharTextFiled(M filedType){

        if(filedType == DATE_TYPE) {
            return false;
        }
        if(filedType == TIMESTAMP_TYPE) {
            return false;
        }
        if(filedType == TEXT_TYPE) {
            return false;
        }
        if(filedType == MEDIUM_TEXT_TYPE) {
            return false;
        }
        if(filedType == LONG_TEXT_TYPE) {
            return false;
        }
        return true;
    }

    public static boolean isNotDefaultValue(M filedType){
        if(filedType == TEXT_TYPE) {
            return true;
        }
        if(filedType == MEDIUM_TEXT_TYPE) {
            return true;
        }
        if(filedType == LONG_TEXT_TYPE) {
            return true;
        }
        return false;
    }

    public static void main(String[] args){
        System.out.println(isAutoIncrementFiled(INT_TYPE));

        System.out.println( isCharTextFiled(TEXT_TYPE));
    }

}
